<?php
echo $this->render('header.phtml');
echo $this->render('header_form.phtml');
?>

<tr class="corFundo">
	<td width="100%" height="100%" valign="top" nowrap class="texto_preto"
		style="padding: 0;">
	<div style="position:relative; width: 100%; margin: 0; padding: 5px 0px 5px 0px;">
<table width="100%" cellspacing="0" cellpadding="2" border="0">
	<tr style="padding-bottom: 20px;">
<?php
$countColuna = 0;
function criaNovoMenu($grupoMenu){
	global $countColuna;
    if ($countColuna >= 3) {
    	echo '<tr style="padding-bottom: 20px;">';
    	$countColuna=0;
    }
    else {
    	$countColuna++;
    }
	?>
	<td valign="top" align="center" width="33%">

	<div class="bordaBox" style="width: 98%">
		<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
			<div class="conteudoBox">
			  <b style="color: white;"><?php echo $grupoMenu; ?></b>
			</div>
		<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>
	</div>
	<div style="padding-left: 10px; text-align: left;">
	
<?php
}

function finalizaMenu(){
	global $countColuna;
	echo "</div";
	echo "</td>";
	if ($countColuna == 3){
		echo "</tr>";
	}
}

$grupoAnt = '';
foreach($this->menuList as $item) {
	if ($item['grupo'] != $grupoAnt) {
		if ($grupoAnt != ''){
			finalizaMenu();
		}
		criaNovoMenu($item['grupo']);
		$grupoAnt = $item['grupo'];
	}
	?>
	<p><a style="text-align:left; width: 95%;" class="<?php echo $item['icone'];?>" href="<?php echo $this->baseUrl .'/'. $item['link'];?>"><?php echo $item['menu'];?></a></p>
<?php
}
if ($countColuna < 3){
	$countColuna = 3;
	finalizaMenu();
}
?>
</table>
</td>
</tr>
<?php 	echo $this->message; 
		echo $this->render('footer.phtml'); ?>
